package com.neusoft;

import java.io.*;

public class CopyFile2 {

    public static void main(String[] args) throws Exception {
        long startTime = System.currentTimeMillis();
        //使用高级流进行文件复制  BufferedInputStream  BufferedOutputStream
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("d:\\kjds.sql"));
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("e:\\kk.sql"));

        //开始复制
        int len = 0;
        byte[] bytes = new byte[1024];

        while((len=bis.read(bytes))!=-1){
            bos.write(bytes,0,len);
        }

        bos.close();
        bis.close();
        long endTime = System.currentTimeMillis();
        System.out.println("复制文件耗时"+(endTime-startTime)+"毫秒");
    }
}
